var fullYear = localStorage.getItem('year') ? localStorage.getItem('year') : new Date().getFullYear();
var nowMonth = new Date().getMonth() > 8 ? (new Date().getMonth() + 1) : '0' + (new Date().getMonth() + 1)
var fullMonth = localStorage.getItem('month') ? localStorage.getItem('month') : nowMonth;
var fullDepartment = localStorage.getItem('dept') ? localStorage.getItem('dept') : '';
var fullDepartmentText = '';
var fullTaskNumber = localStorage.getItem('taskNumber') ? localStorage.getItem('taskNumber') : '';
var fullTaskNumberText = '';
const getUsername = localStorage.getItem("user")

let zijin;
let Bussiness;
let plantask;
let initCapitalIncome; //资金流入
let finance; //财务主页
let capitalCost; //资金流出
let mainIndicators; //主要指标

let initPlanTask; //业务计划
let initBussinessCost; //业务支出
let yue; // 期末现金及等价物余额
let Investment; //资产负债
let initcashflowCost; //现金流量
let initProfitCost; //利润
let zuzhijiagou; //组织架构
let implementationRate; // 预算执行率说明
let yewuData; //首页
let classesContrast; // dss 项目预算 类别对比
let sectorSpend; // dss 部门收支
let departmentalCharge; // dss 部门费用
let BUcontrast; // dss 项目预算 各事业部对比
let expendGroup; // dss 部门收支 全所支出组成
let financialFund; // dss 财政资金

let guanxitu; //关系图
let DSSindex; //DSS首页
let xiangmuyusuan; //DSS项目预算
let xiangmushouzhi; //DSS项目收支
let laikuanzucheng; //DSS来款组成
let yuedufenxi; //DSS月度分析
let ketishouzhi; //DSS课题收支
let sanlanzhang; //DSS项目三栏账
let gebumenduibi; //DSS各部门对比
let chenbenzucheng; //DSS成本组成

let budgetThird; // 预算执行
let budgetEnforcementTotal;
let Statistics; // 2022预算--首页
let StatisticsIncoming; //来款执行

let IncomingPayment; //来款情况
let AllIncomingPayment; //来款情况--全部

let ProjectLibrary; //项目库
let ProjectCard; //项目卡片
let incomePage; //收入
let expenditurePage; //支出


let isExpansion = false;

localStorage.setItem('year', fullYear);
localStorage.setItem('month', fullMonth);
localStorage.setItem('dept', fullDepartment);
localStorage.setItem('taskNumber', fullTaskNumber);

document.getElementById('year') ? layui.use(['laydate'], function(laydate) {
	laydate.render({
		elem: '#year',
		type: 'month',
		theme: '#165DFF',
		value: fullYear + "-" + fullMonth,
		//,range: true 
		//,trigger: 'click'
		done: function(value, date, endDate) {
			fullYear = value.split('-')[0]
			fullMonth = value.split('-')[1]

			localStorage.setItem('year', fullYear);
			localStorage.setItem('month', fullMonth);

			change()
		},
		change: function(value, date, endDate) {
			//this.elem.val(value)
		}
	});
}) : ''

document.getElementById('yearDate') ? layui.use(['laydate'], function(laydate) {
	laydate.render({
		elem: '#yearDate',
		type: 'year',
		theme: '#165DFF',
		value: fullYear,
		//,range: true 
		//,trigger: 'click'
		done: function(value, date, endDate) {
			fullYear = value
			fullMonth = date.month
			localStorage.setItem('year', fullYear);
			localStorage.setItem('month', fullMonth);

			change()
		},
		change: function(value, date, endDate) {
			//this.elem.val(value)
		}
	});
}) : ''

function change() {
	if (ProjectCard) {
		initProjectCardData()
	}
	if (ProjectLibrary) {
		initProjectLibraryData()
	}
	if (guanxitu) {
		initguanxituData()
	}
	if (DSSindex) {
		initDDSindexData()
	}
	if (laikuanzucheng) {
		initlaikuanzuchengData()
	}
	if (yuedufenxi) {
		inityuedufenxiData()
	}
	if (ketishouzhi) {
		initketishouzhiData()
	}
	if (sanlanzhang) {
		initsanlanzhangData()
	}
	if (gebumenduibi) {
		initgebumenduibiData();
		getgebumenduibiTable();
	}
	if (chenbenzucheng) {
		initchenbenzuchengData();
	}
	if (xiangmuyusuan) {
		initxiangmuyusuanData();
	}
	if (xiangmushouzhi) {
		initxiangmushouzhiData();
	}
	if (yewuData) {
		inityewuData()
	}
	if (zijin) {
		getCapitalData()
	}
	if (Bussiness) {
		initBussinessData()
	}
	if (finance) {
		initfinanceData()
	}
	if (capitalCost) {
		initcapitalCostData()
	}
	if (mainIndicators) {
		initmainIndicators();
	}

	if (initCapitalIncome) {
		initCapitalIncomeData()
	}
	if (initPlanTask) {
		initPlanTaskData()
	}
	if (initBussinessCost) {
		initBussinessCostData()
	}
	if (initcashflowCost) {
		initcashflowCostData();
	}
	if (initProfitCost) {
		initProfitCostData();
	}
	if (yue) {
		getResidualData()
	}
	if (Investment) {
		initInvestmentData()
	}
	if (zuzhijiagou) {
		yewuTreeData(1);
	}
	if (classesContrast) {
		getClassesContrast()
	}
	if (sectorSpend) {
		getSpendData()
	}
	if (departmentalCharge) {
		getDepartmentalCharge()
	}
	if (BUcontrast) {
		getBUcontrast()
	}
	if (expendGroup) {
		getExpendGroup()
	}
	if (financialFund) {
		getFinancialFundData()
	}

	if (implementationRate) {
		getImplementationRate()
	}

	if (budgetThird) {
		window.location.reload()
	}
	if (Statistics) {
		initStatisticsData();
	}
	if (StatisticsIncoming) {
		initStatisticsIncomingData()
	}
	if (budgetEnforcementTotal) {
		initBudgetEnforcementTotal()
	}
	if (IncomingPayment) {
		// getIncomingPayment(2)
	}
	if (AllIncomingPayment) {
		// getAllIncomingPayment()
	}
	if (incomePage) {
		renderIncomePage()
	}
	if (expenditurePage) {
		renderexpenditurePage()
	}
}

$(function() {
	// <li class="parentLi dbmfy">
	// 	<div class="${url == 'businessSegment.html'?'active':''}">
	// 		<a href="businessSegment.html">
	// 			<img class="default" src="assets/images/newNav/icon_Budgetimplementation.svg">
	// 			<img class="hover" src="assets/images/newNav/icon_Budgetimplementation_selected.svg">
	// 			<p class="opacity">预算执行</p>
	// 		</a>
	// 	</div>
	// 	<div class="tip packUp">
	// 		<p>预算执行</p>
	// 	</div>
	// </li>
	// <li class="parentLi dbmfy">
	// 	<div class="${url == 'IncomingPayment.html'?'active':''}">
	// 		<a href="IncomingPayment.html">
	// 			<img class="default" src="assets/images/newNav/icon_payment.svg">
	// 			<img class="hover" src="assets/images/newNav/icon_payment_selected.svg">
	// 			<p class="opacity">来款情况</p>
	// 		</a>
	// 	</div>
	// 	<div class="tip packUp">
	// 		<p>来款情况</p>
	// 	</div>
	// </li>

	$('.search>div.section ').on('click', '.options div', function(event) {
		event.stopPropagation();
		const isTask = document.getElementsByClassName('sectionTask')[0] ? true : false;
		let options = ''
		let num = '';
		if (isTask) {
			fullTaskNumber = [];
			fullTaskNumberText = ''
		} else {
			fullDepartment = []
			fullDepartmentText = '';
		}
		$(this).toggleClass('checked')
		if ($(this).hasClass('all')) {
			if ($(this).hasClass('checked')) {
				$(this).removeClass('half')
				$('.search>div.section .options div.unit').addClass('checked');
				$('.search>div.section .sector div').html(`<span>${isTask?'全部':'全所'}</span>`)
				if (isTask) {
					fullTaskNumber = '';
					fullTaskNumberText = ''
				} else {
					fullDepartment = ''
					fullDepartmentText = '';
				}
			} else {
				$(this).removeClass('half')
				$('.search>div.section .options div.unit').removeClass('checked')
				if (isTask) {
					fullTaskNumber = '';
					fullTaskNumberText = ''
				} else {
					fullDepartment = ''
					fullDepartmentText = '';
				}
			}
		} else {
			if ($('.search>div.section .options div.unit.checked').length == 0) {
				$('.search>div.section .options div.all').removeClass('checked')
				$('.search>div.section .options div.all').removeClass('half')
				$('.search>div.section .sector div').html('')
				if (isTask) {
					fullTaskNumber = '';
					fullTaskNumberText = ''
				} else {
					fullDepartment = ''
					fullDepartmentText = '';
				}
			} else if ($('.search>div.section .options div.unit.checked').length < $(
					'.search>div.section .options div.unit').length || !$(
					'.search>div.section .options div').eq(0).hasClass('all')) {
				$('.search>div.section .options div.all').removeClass('checked')
				$('.search>div.section .options div.all').addClass('half')
				$('.search>div.section .options div.unit.checked').each(function(index) {
					if (isTask) {
						fullTaskNumber.push($(this).attr('data-num'));
						fullTaskNumberText += $(this).find('p').text() + ' '
					} else {
						fullDepartment.push($(this).attr('data-num'))
						fullDepartmentText += $(this).find('p').text() + ' '
					}
					if (index < 3) {
						let op = `<span>${$(this).find('p').text()}</span>`;
						options += op
					} else {
						num = `<span>+${index - 2}</span>`;
					}

				})
				if (num) {
					options += num
				}
				if (isTask) {
					fullTaskNumber = fullTaskNumber.join(',')
				} else {
					fullDepartment = fullDepartment.join(',')
				}
				$('.search>div.section .sector div').html(options)
			} else if ($('.search>div.section .options div.unit.checked').length == $(
					'.search>div.section .options div.unit').length) {
				$('.search>div.section .options div.all').addClass('checked')
				$('.search>div.section .options div.all').removeClass('half')
				if ($('.search>div.section .options div').hasClass('all')) {

					$('.search>div.section .sector div').html(`<span>${isTask?'全部':'全所'}</span>`)
				}
				if (isTask) {
					fullTaskNumber = '';
					fullTaskNumberText = ''
				} else {
					fullDepartment = ''
					fullDepartmentText = '';
				}
			}
		}
		if (isTask) {
			fullTaskNumberText = fullTaskNumberText.trim()
			localStorage.setItem('taskNumber', fullTaskNumber);
			localStorage.setItem('taskNumberText', fullTaskNumberText)
		} else {
			fullDepartmentText = fullDepartmentText.trim()
			localStorage.setItem('dept', fullDepartment);
			localStorage.setItem('deptText', fullDepartmentText)
		}
		change()

	})

	$('.search>div.section').click(function() {
		$('.search>div.section .options').toggle()
	})
	$('.search>div.section').click(function(event) {
		event.stopPropagation();
	})
	$(document).click(function() {
			$('.search>div.section .options').hide()
		})

		!document.getElementsByClassName('sectionTask')[0] && document.getElementsByClassName('options')[0] &&
		getDepartment()
	document.getElementsByClassName('sectionTask')[0] && document.getElementsByClassName('options')[0] &&
		getTaskNumber()

	function getDepartment() {
		let options = ''
		$.get(`${API_URL}getList/deptAuth?username=${localStorage.getItem('user')}`, {}, function(e) {

			for (let i = 0; i < e.items.length; i++) {
				options += `<div class="${e.items[i].dept_name == '全所'?'all':'unit'}" data-num="${e.items[i].dept_code}">
									<i></i>
									<p>${e.items[i].dept_name}</p>
								</div>`
			}
			$('.search>div.section .sector span').text(e.items[0].dept_name)
			$('.search>div.section .options').html(options)
			if (!localStorage.getItem('deptText')) {
				if (e.items[0].dept_name == '全所') {
					$('.search>div.section .options div').addClass('checked')
				} else {
					$('.search>div.section .options div').eq(0).addClass('checked')
				}
				fullDepartment = e.items[0].dept_code
				fullDepartmentText = e.items[0].dept_name
				localStorage.setItem('dept', fullDepartment);
				localStorage.setItem('deptText', fullDepartmentText)
			} else {
				if (localStorage.getItem('deptText') != '全所') {
					initDepart(e.items)
				} else {
					$('.search>div.section .options div').addClass('checked')
				}
			}
		})
	}

	function getTaskNumber() {
		let options = ''
		$.get(`${API_URL}getList/xm?username=${localStorage.getItem('user')}`, {}, function(e) {
			e.items.unshift({
				"bh": "",
				"rwh": "全部"
			})
			for (let i = 0; i < e.items.length; i++) {
				options += `<div class="${e.items[i].rwh == '全部'?'all':'unit'}" data-num="${e.items[i].bh}">
									<i></i>
									<p>${e.items[i].rwh}</p>
								</div>`
			}
			$('.search>div.sectionTask .sector span').text(e.items[0].rwh)
			$('.search>div.sectionTask .options').html(options)
			if (!localStorage.getItem('taskNumberText')) {
				if (e.items[0].rwh == '全部') {
					$('.search>div.sectionTask .options div').addClass('checked')
				} else {
					$('.search>div.sectionTask .options div').eq(0).addClass('checked')
				}
				fullTaskNumber = e.items[0].bh
				fullTaskNumberText = e.items[0].rwh
				localStorage.setItem('taskNumber', fullTaskNumber);
				localStorage.setItem('taskNumberText', fullTaskNumberText)
			} else {
				if (localStorage.getItem('taskNumberText') != '全部') {
					initDepart(e.items)
				} else {
					$('.search>div.sectionTask .options div').addClass('checked')
				}
			}
		})
	}




	function initDepart(data) {
		const isTask = document.getElementsByClassName('sectionTask')[0] ? true : false;
		let spans = '';
		if (isTask) {
			const taskNumberText = localStorage.getItem('taskNumberText').split(' ');
			for (let i = 0; i < data.length; i++) {
				for (let j = 0; j < taskNumberText.length; j++) {
					if (taskNumberText[j] == data[i].rwh) {
						$('.search>div.section .options div').eq(i).addClass('checked')
					}
				}
			}
			const nums = taskNumberText.length > 3 ? 3 : taskNumberText.length;
			for (let i = 0; i < nums; i++) {
				spans += `<span>${taskNumberText[i]}</span>`
			}
			if (taskNumberText.length > 3) {
				spans += `<span>+${taskNumberText.length - 3}</span>`
			}
		} else {
			let deptText = localStorage.getItem('deptText').split(' ');
			for (let i = 0; i < data.length; i++) {
				for (let j = 0; j < deptText.length; j++) {
					if (deptText[j] == data[i].dept_name) {
						$('.search>div.section .options div').eq(i).addClass('checked')
					}
				}
			}
			const nums = deptText.length > 3 ? 3 : deptText.length;
			for (let i = 0; i < nums; i++) {
				spans += `<span>${deptText[i]}</span>`
			}
			if (deptText.length > 3) {
				spans += `<span>+${deptText.length - 3}</span>`
			}
		}

		$('.search>div.section .options div.all').addClass('half')
		$('.search>div.section .sector div').html(spans)
	}






	$('.container .navigation').on('click', '.toggle', function() {
		
		$('.container .navigation .childUl').hide()
		if (isExpansion) {
			isExpansion = false;
			$('.container .navigation .toggle.expansion').hide();
			$('.container .navigation .toggle.packUp').show();

			$('.container .navigation').attr('class', 'navigation before tran');
			$('.container  .content').removeClass('after')
		} else {
			isExpansion = true;
			$('.container .navigation .toggle.expansion').show();
			$('.container .navigation .toggle.packUp').hide();
			$('.container .navigation').attr('class', 'navigation after tran');
			$('.container  .content').addClass('after')
		}
		localStorage.setItem('isExpansion', isExpansion);
	})

	$('.container .navigation').on('click', '.parentLi img.arrow', function() {
		$(this).parent().next().slideToggle()
	})
	// initNav()
	renewalTime()


	navInt()
})

function navInt() {
	let url = window.location.pathname;
	url = url.split('/');
	url = url[url.length - 1]
	$('.navigation').html(`<div class="logo">
				<!-- <img class="expansion" src="assets/images/nav/logo.svg">
					<img class="packUp" src="assets/images/nav/logo-tu.svg"> -->
				<!-- <img class="packUp" src="assets/images/waiw/logo@2x.png"> -->
				<img class="expansion" src="assets/images/waiw/logozhankai@2x.png">
				<img class="toggle packUp" src="assets/images/newNav/icon-zhankai.svg">
				<img class="toggle expansion" src="assets/images/newNav/icon-zhedie.svg">
			</div>
			<div class="list">
				<ul>
					<li class="parentLi">
						<div class="${url == 'index.html'||url == 'projectDetail.html'?'active':''}">
							<a href="index.html">
								<img class="default" src="assets/images/newNav/icon_home_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_home_selected.svg">
								<p class="opacity">首页</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>首页</p>
						</div>
					</li>
					
					<!-- <li class="parentLi nshouye">
						<div class="${url == 'index.html'?'active':''}">
							<a href="index.html">
								<img class="default" src="assets/images/newNav/icon_home_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_home_selected.svg">
								<p class="opacity">首页</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>首页</p>
						</div>
					</li> -->
					<!-- <li class="parentLi yszx">
						<div class="${(url == 'Statistics-2022.html'||url == 'budget-enforcement-third.html'||url == 'budget-enforcement-fourth.html'||url == 'budget-enforcement-fifth-cl.html'||url == 'budget-enforcement-fifth.html'||url == 'budget-enforcement-tree.html'||url == 'Statistics-Incoming.html'||url == 'budget-IncomingPayment.html'||url == 'budget-All-IncomingPayment.html')?'active':''}">
							<a href="Statistics-2022.html">
								<img class="default" src="assets/images/newNav/icon_tongji.svg">
								<img class="hover" src="assets/images/newNav/icon_tongji_selected.svg">
								<p class="opacity">预算执行统计</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>预算执行</p>
						</div>
					</li> -->
					<!-- <li class="parentLi nyewu">
						<div class="${url == 'business.html'?'active':url == 'plantask.html'?'active':url == 'businessexpense.html'?'active':url == 'guanxitu.html'?'active':''}">
							<a href="business.html">
								<img class="default" src="assets/images/newNav/icon_business_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_business_selected.svg">
								<p class="opacity">业务</p>
							</a>
							<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
							<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
						</div>
						<ul class="childUl">
							<li class="childLi">
								<a class="${url == 'plantask.html'?'active':''}" href="plantask.html">
									计划
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'businessexpense.html'?'active':''}" href="businessexpense.html">
									支出
								</a>
							</li>
						</ul>
					</li> -->
					<!-- <li class="parentLi nzijin">
						<div class="${url == 'capital.html'?'active':url == 'capitalIncome.html'?'active':url == 'capitalCost.html'?'active':url == 'residual.html'?'active':''}">
							<a href="capital.html">
								<img class="default" src="assets/images/newNav/icon_Funds_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_Funds_selected.svg">
								<p class="opacity">资金</p>
							</a>
							<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
							<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
						</div>
						<ul class="childUl">
							<li class="childLi">
								<a class="${url == 'capitalIncome.html'?'active':''}" href='capitalIncome.html'>
									流入
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'capitalCost.html'?'active':''}" href="capitalCost.html">
									流出
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'residual.html'?'active':''}" href="residual.html">
									现金及等价物余额
								</a>
							</li>
						</ul>
					</li> -->
					<!-- <li class="parentLi ncaiwu">
						<div class="${url == 'finance.html'?'active':url == 'Investment.html'?'active':url == 'profit.html'?'active':url == 'cashflow.html'?'active':url == 'mainIndicators.html'?'active':''}">
							<a href="finance.html">
								<img class="default" src="assets/images/newNav/icon_Finance_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_Finance_selected.svg">
								<p class="opacity">财务</p>
							</a>
							<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
							<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
						</div>
						<ul class="childUl">
							<li class="childLi">
								<a class="${url == 'Investment.html'?'active':''}" href="Investment.html">
									资产负债
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'profit.html'?'active':''}" href="profit.html">
									利润
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'cashflow.html'?'active':''}" href="cashflow.html">
									现金流量
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'mainIndicators.html'?'active':''}" href="mainIndicators.html">
									主要指标
								</a>
							</li>
						</ul>
					</li> -->
					<li class="parentLi yszx">
						<div class="${(url == 'Statistics-2022.html'||url == 'budget-enforcement-total.html'||url == 'budget-enforcement-total-tree.html'||url == 'Statistics-Incoming.html'||url == 'budget-IncomingPayment.html'||url == 'budget-All-IncomingPayment.html')?'active':''}">
							<a href="Statistics-2022.html">
								<img class="default" src="assets/images/newNav/icon_tongji.svg">
								<img class="hover" src="assets/images/newNav/icon_tongji_selected.svg">
								<p class="opacity">预算执行统计</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>预算执行</p>
						</div>
					</li>
					<li class="parentLi">
						<div class="${url == 'comprehensive-budget.html'||url == 'business.html'||url == 'businessexpense.html'||url == 'capital.html'||url == 'capitalIncome.html'||url == 'capitalCost.html'||url == 'residual.html'||url == 'finance.html'||url == 'Investment.html'||url == 'profit.html'||url == 'cashflow.html'||url == 'mainIndicators.html'?'active':''}">
							<a href="comprehensive-budget.html">
								<img class="default" src="assets/images/newNav/icon_kanban_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_kanban_selected.svg">
								<p class="opacity">全面预算</p>
							</a>
							<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
							<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
						</div>
						<ul class="childUl">
							<li class="childLi">
								<div class="${url == 'business.html'?'active':url == 'plantask.html'?'active':url == 'businessexpense.html'?'active':url == 'guanxitu.html'?'active':''}">
									<a href="business.html">
										业务
									</a>
									<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
									<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
								</div>
								<ul class="childUl">
									<li class="childLi">
										<a class="${url == 'businessexpense.html'?'active':''}" href="businessexpense.html">
											支出
										</a>
									</li>
								</ul>
							</li>
							<li class="childLi">
								<div class="${url == 'capital.html'?'active':url == 'capitalIncome.html'?'active':url == 'capitalCost.html'?'active':url == 'residual.html'?'active':''}">
									<a href="capital.html">
										资金
									</a>
									<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
									<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
								</div>
								<ul class="childUl">
									<li class="childLi">
										<a class="${url == 'capitalIncome.html'?'active':''}" href='capitalIncome.html'>
											流入
										</a>
									</li>
									<li class="childLi">
										<a class="${url == 'capitalCost.html'?'active':''}" href="capitalCost.html">
											流出
										</a>
									</li>
									<li class="childLi">
										<a class="${url == 'residual.html'?'active':''}" href="residual.html">
											现金及等价物余额
										</a>
									</li>
								</ul>
							</li>
							<li class="childLi">
								<div class="${url == 'finance.html'?'active':url == 'Investment.html'?'active':url == 'profit.html'?'active':url == 'cashflow.html'?'active':url == 'mainIndicators.html'?'active':''}">
									<a href="finance.html">
										财务
									</a>
									<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
									<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
								</div>
								<ul class="childUl">
									<li class="childLi">
										<a class="${url == 'Investment.html'?'active':''}" href="Investment.html">
											资产负债
										</a>
									</li>
									<li class="childLi">
										<a class="${url == 'profit.html'?'active':''}" href="profit.html">
											利润
										</a>
									</li>
									<li class="childLi">
										<a class="${url == 'cashflow.html'?'active':''}" href="cashflow.html">
											现金流量
										</a>
									</li>
									<li class="childLi">
										<a class="${url == 'mainIndicators.html'?'active':''}" href="mainIndicators.html">
											主要指标
										</a>
									</li>
								</ul>
							</li>
						</ul>
					</li>
					<li class="parentLi allocation dshouye">
						<div class="${url == 'DSS-index.html'||url == 'projectRevenueExpenditure.html'||url == 'compositionIncomingPayment.html'||url == 'monthlyAnalysis.html'||url == 'comparisonDepartments.html'||url == 'topic.html'||url == 'threeColumn.html'||url == 'projectBudget.html'||url == 'classesContrast.html'||url == 'BUcontrast.html'||url == 'costComposition.html'||url == 'sector-spend.html'||url == 'expend-group.html'||url == 'sector-tabs.html'||url == 'sector-addUp.html'||url == 'departmental-charge.html'||url == 'financial-fund.html'?'active':''}">
							<a href="DSS-index.html">
								<img class="default" src="assets/images/newNav/icon_dss_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_dss_selected.svg">
								<p class="opacity">DSS</p>
							</a>
							<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
							<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
						</div>
						<ul class="childUl">
							<li class="childLi">
								<div class="${url == 'projectRevenueExpenditure.html'?'active':url == 'compositionIncomingPayment.html'?'active':url == 'monthlyAnalysis.html'?'active':url == 'comparisonDepartments.html'?'active':url == 'topic.html'?'active':url == 'threeColumn.html'?'active':''}">
									<a href="projectRevenueExpenditure.html">
										项目收支
									</a>
									<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
									<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
								</div>
								<ul class="childUl">
									<li class="childLi">
										<a class="${url == 'compositionIncomingPayment.html'?'active':''}" href="compositionIncomingPayment.html">
											来款组成
										</a>
									</li>
									<li class="childLi">
										<a class="${url == 'monthlyAnalysis.html'?'active':''}" href="monthlyAnalysis.html">
											月度分析
										</a>
									</li>
									<li class="childLi">
										<a class="${url == 'comparisonDepartments.html'?'active':url == 'topic.html'?'active':url == 'threeColumn.html'?'active':''}" href="comparisonDepartments.html">
											各部门对比
										</a>
									</li>
								</ul>
							</li>
							<li class="childLi">
								<div class="${url == 'projectBudget.html'?'active':url == 'classesContrast.html'?'active':url == 'BUcontrast.html'?'active':url == 'costComposition.html'?'active':''}">
									<a href="projectBudget.html">
										项目预算
									</a>
									<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
									<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
								</div>
								<ul class="childUl">
									<li class="childLi">
										<a class="${url == 'classesContrast.html'?'active':''}" href="classesContrast.html">
											类别对比
										</a>
									</li>
									<li class="childLi">
										<a class="${url == 'BUcontrast.html'?'active':''}" href="BUcontrast.html">
											各事业部对比
										</a>
									</li>
									<li class="childLi">
										<a class="${url == 'costComposition.html'?'active':''}" href="costComposition.html">
											成本组成
										</a>
									</li>
								</ul>
							</li>
							<li class="childLi">
								<a class="${url == 'sector-spend.html'?'active':url == 'expend-group.html'?'active':url == 'sector-tabs.html'?'active':url == 'sector-addUp.html'?'active':''}" href="sector-spend.html">
									部门收支
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'departmental-charge.html'?'active':''}" href="departmental-charge.html">
									部门费用
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'financial-fund.html'?'active':''}" href="financial-fund.html">
									财政资金
								</a>
							</li>
						</ul>
					</li>
					<!-- <li class="parentLi allocation dshouye">
						<div class="${url == 'DSS-index.html'?'active':''}">
							<a href="DSS-index.html">
								<img class="default" src="assets/images/newNav/icon_dss_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_dss_selected.svg">
								<p class="opacity">DSS</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>DSS</p>
						</div>
					</li>
					<li class="parentLi dxmsz">
						<div class="${url == 'projectRevenueExpenditure.html'?'active':url == 'compositionIncomingPayment.html'?'active':url == 'monthlyAnalysis.html'?'active':url == 'comparisonDepartments.html'?'active':url == 'topic.html'?'active':url == 'threeColumn.html'?'active':''}">
							<a href="projectRevenueExpenditure.html">
								<img class="default" src="assets/images/newNav/icon_projectbalance_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_projectbalance_selected.svg">
								<p class="opacity">项目收支</p>
							</a>
							<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
							<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
						</div>
						<ul class="childUl">
							<li class="childLi">
								<a class="${url == 'compositionIncomingPayment.html'?'active':''}" href="compositionIncomingPayment.html">
									来款组成
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'monthlyAnalysis.html'?'active':''}" href="monthlyAnalysis.html">
									月度分析
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'comparisonDepartments.html'?'active':url == 'topic.html'?'active':url == 'threeColumn.html'?'active':''}" href="comparisonDepartments.html">
									各部门对比
								</a>
							</li>
						</ul>
					</li>
					<li class="parentLi dxmys">
						<div class="${url == 'projectBudget.html'?'active':url == 'classesContrast.html'?'active':url == 'BUcontrast.html'?'active':url == 'costComposition.html'?'active':''}">
							<a href="projectBudget.html">
								<img class="default" src="assets/images/newNav/icon_projectbuget_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_projectbuget_selected.svg">
								<p class="opacity">项目预算</p>
							</a>
							<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
							<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
						</div>
						<ul class="childUl">
							<li class="childLi">
								<a class="${url == 'classesContrast.html'?'active':''}" href="classesContrast.html">
									类别对比
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'BUcontrast.html'?'active':''}" href="BUcontrast.html">
									各事业部对比
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'costComposition.html'?'active':''}" href="costComposition.html">
									成本组成
								</a>
							</li>
						</ul>
					</li>
					<li class="parentLi dbmsz">
						<div class="${url == 'sector-spend.html'?'active':url == 'expend-group.html'?'active':url == 'sector-tabs.html'?'active':url == 'sector-addUp.html'?'active':''}">
							<a href="sector-spend.html">
								<img class="default" src="assets/images/newNav/icon_departbalance_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_departbalance_selected.svg">
								<p class="opacity">部门收支</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>部门收支</p>
						</div>
					</li>
					<li class="parentLi dbmfy">
						<div class="${url == 'departmental-charge.html'?'active':''}">
							<a href="departmental-charge.html">
								<img class="default" src="assets/images/newNav/icon_departbuget_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_departbuget_selected.svg">
								<p class="opacity">部门费用</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>部门费用</p>
						</div>
					</li>
					<li class="parentLi dczzj">
						<div class="${url == 'financial-fund.html'?'active':''}">
							<a href="financial-fund.html">
								<img class="default" src="assets/images/newNav/icon_projfinance_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_projfinance_selected.svg">
								<p class="opacity">财政资金</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>财政资金</p>
						</div>
					</li> -->
					<li class="parentLi allocation xmk">
						<div class="${url == 'ProjectLibrary.html'?'active':url == 'finance.html'?'active':url == 'ProjectCard.html'?'active':url == 'income.html'?'active':url == 'expenditure.html'?'active':''}">
							<a href="ProjectLibrary.html">
								<img class="default" src="assets/images/newNav/icon_project_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_project_selected.svg">
								<p class="opacity">成本项目</p>
							</a>
							<img class="arrow default" src="assets/images/nav/icon-xiala.svg">
							<img class="arrow hover" src="assets/images/nav/icon-xiala-w.svg">
						</div>
						<ul class="childUl">
							<li class="childLi">
								<a class="${url == 'ProjectCard.html'?'active':''}" href="ProjectCard.html">
									项目卡片
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'income.html'?'active':''}" href="income.html">
									收入
								</a>
							</li>
							<li class="childLi">
								<a class="${url == 'expenditure.html'?'active':''}" href="expenditure.html">
									支出
								</a>
							</li>
						</ul>
					</li>
					<li class="parentLi allocation">
						<div class="${url == 'construction-project.html'?'active':''}">
							<a href="construction-project.html">
								<img class="default" src="assets/images/newNav/icon_construction_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_construction_selected.svg">
								<p class="opacity">基建项目</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>基建项目</p>
						</div>
					</li>
					<!-- <li class="parentLi xmk allocation">
						<div class="${url == 'ProjectLibrary.html'?'active':''}">
							<a href="ProjectLibrary.html">
								<img class="default" src="assets/images/newNav/icon_project_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_project_selected.svg">
								<p class="opacity">项目库</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>项目库</p>
						</div>
					</li>
					<li class="parentLi xmkp">
						<div class="${url == 'ProjectCard.html'?'active':''}">
							<a href="ProjectCard.html">
								<img class="default" src="assets/images/newNav/icon_card_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_card_selected.svg">
								<p class="opacity">项目卡片</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>项目卡片</p>
						</div>
					</li>
					<li class="parentLi">
						<div class="${url == 'income.html'?'active':''}">
							<a href="income.html">
								<img class="default" src="assets/images/newNav/icon_Income_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_Income_selected.svg">
								<p class="opacity">收入</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>收入</p>
						</div>
					</li>
					<li class="parentLi">
						<div class="${url == 'expenditure.html'?'active':''}">
							<a href="expenditure.html">
								<img class="default" src="assets/images/newNav/icon_Income_normal.svg">
								<img class="hover" src="assets/images/newNav/icon_Income_selected.svg">
								<p class="opacity">支出</p>
							</a>
						</div>
						<div class="tip packUp">
							<p>支出</p>
						</div>
					</li> -->				
					<!-- <li class="parentLi allocation">
							<div>
								<a href="index.html">
									<img class="default" src="assets/images/newNav/icon_peizhi_normal.svg">
									<img class="hover" src="assets/images/newNav/icon_home_selected.svg">
									<p class="opacity">后台配置</p>
								</a>
							</div>
							<div class="tip packUp">
								<p>后台配置</p>
							</div>
						</li> -->
				</ul>
			</div>
			<p class="footer expansion">航天材料及工艺研究所</p>`)
	// 导航权限
	navPermi()
}

function initNav() {
	if (localStorage.getItem('isExpansion') == 'true') {
		$('.container .content header .left .toggle.expansion').show();
		$('.container .content header .left .toggle.packUp').hide();
		$('.container .navigation').attr('class', 'navigation after');
		$('.container  .content').addClass('after')
	} else {
		$('.container .content header .left .toggle.expansion').hide();
		$('.container .content header .left .toggle.packUp').show();
		$('.container .navigation').attr('class', 'navigation before');
		$('.container  .content').removeClass('after')
	}
}
// 导航权限
function navPermi() {
	let permi = JSON.parse(localStorage.getItem('permission'));
	$('.container .content header .menu .user p ').text(getUsername.slice(0, 1))
	if (permi.key01 == 0) {
		$('.parentLi.nyewu').hide()
	}
	if (permi.key02 == 0) {
		$('.parentLi.nzijin').hide()
	}
	if (permi.key03 == 0) {
		$('.parentLi.ncaiwu').hide()
	}
	if (permi.key06 == 0) {
		$('.parentLi.dshouye').hide()
		$('.parentLi.dxmsz').hide()
		$('.parentLi.dxmys').hide()
		$('.parentLi.dbmsz').hide()
		$('.parentLi.dbmfy').hide()
		$('.parentLi.dczzj').hide()
	}
	if (permi.key07 == 0) {
		$('.parentLi.dxmsz').hide()
	}
	if (permi.key08 == 0) {
		$('.parentLi.dxmys').hide()
	}
	if (permi.key09 == 0) {
		$('.parentLi.dbmsz').hide()
	}
	if (permi.key10 == 0) {
		$('.parentLi.dbmfy').hide()
	}
	if (permi.key11 == 0) {
		$('.parentLi.dczzj').hide()
	}
	if (permi.key12 == 0) {
		$('.parentLi.yszx').hide()
	}
}

// 更新于：time
function renewalTime() {
	$.get(
		`${API_URL}getdata?status=2&chartPage=99`, {},
		function(res) {
			let re = eval("(" + res + ")");
			$('.container .content header .right time').text(`更新于：${re.items[0].charts[0].data[0].key01}`)
		})
}
